﻿@{
    ViewBag.Title = "正式订单";
    Layout = "~/Views/Shared/_LayoutList.cshtml";
}
@(Html.nbGridFor<DishOrder>(s =>
{
    s.Action(@Url.Action("OfferList"));
    s.Columns(c =>
    {
        c.Bind(m => m.Id).IsKey();
        c.BindDateTime(m => m.OrderDate).AsSearch();
        c.Bind(m => m.SiteName).Width(60);
        c.Bind(m => m.TotalCost).Width(50).Align(GridAlign.Right);
        c.Bind(m => m.ItemDesc).Width("auto").Align(GridAlign.Left).AsQuery().AsSearch();
        c.Bind(m => m.State).Width(50).AsSearch();
        c.Bind(m => m.ReportUserName).Width(60);
        c.BindDateTime(m => m.ReportDate).AsSearch();
        c.BindTemplate().Width(160)
            .Template(@<a href="javascript:ReportOrder('${Id}','${State}','${OrderDate}')" class="imgbtn2"><span
                class="accept">上报</span></a>)
            .Template(Url.GridRowEditLink("编辑订单", "OfferEdit"))
            .Template(Url.GridRowDeleteLink("SiteName", "OfferDelete"));
    });
    s.Buttons(b =>
    {
        b.BindAddButton("添加订单").Action("OfferEdit");
        b.BindDeleteButton("OfferDeleteAll");
        //b.BindAddButton("批量上报");  9月6日这次演示暂时不开放
    });
}))
<script type="text/javascript">
    function ReportOrder(id, state, orderDate) {
        if (state == "上报") {
            alert("订单状态已经上报了，不能重复上报！");
        }
        else {
            OpenModalDialog('@Url.Action("OfferReportOrder")?Id=' + id, {
                width: 610,
                height: 250,
                caption: "上报订单（" + orderDate + "）",
                onclose: refreshGrid
            });
        }
    }
</script>
